:: 设置备份文件的路径和名称
set backup_dir=E:\backup
set backup_file=%backup_dir%\%date:~11,3%.zip
set backup_count=0

:: 获取备份文件夹中.zip文件的数量
for /f %%A in ('dir /b %backup_dir%\*.zip ^| find /c /v ""') do set backup_count=%%A

:: 检查并删除已存在的备份.zip文件，以防止7zip压缩失败
if exist %backup_file% (
    echo 删除已存在的备份文件：%backup_file%
    del %backup_file%
)

:: 执行备份操作
exp interlib/interlib file=%backup_dir%\%date:~11,3%.dmp log=%backup_dir%\%date:~11,3%.log

:: 使用 7zip 压缩备份文件
"C:\Program Files (x86)\7-Zip\7z.exe" a -tzip %backup_file% %backup_dir%\%date:~11,3%.dmp %backup_dir%\%date:~11,3%.log